<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>ECSHOP 管理中心 - 商品分类</title>
<meta name="robots" content="noindex, nofollow">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="/Public/Admin/Styles/general.css" rel="stylesheet" type="text/css" />
<link href="/Public/Admin/Styles/main.css" rel="stylesheet" type="text/css" />
</head>
<body>

<h1>
    <span class="action-span"><a href="#">商品分类</a></span>
    <span class="action-span1"><a href="#">ECSHOP 管理中心</a></span>
    <span id="search_id" class="action-span1"> - 添加分类 </span>
    <div style="clear:both"></div>
</h1>

<div class="main-div">
    
<div class="form-div">
    <form action="" name="searchForm">
        <img src="/Public/Admin/Images/icon_search.gif" width="26" height="22" border="0" alt="search" />
        <!-- 分类 -->
        <select name="cat_id">
            <option value="0">所有分类</option>
            <?php if(is_array($tree)): $i = 0; $__LIST__ = $tree;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><option value="<?php echo ($vo["id"]); ?>"><?php echo (str_repeat('&nbsp;',$vo["lev"])); echo ($vo["cname"]); ?></option><?php endforeach; endif; else: echo "" ;endif; ?>
        </select>

        <!-- 推荐 -->
        <select name="intro_type">
            <option value="0">全部</option>
            <option value="is_rec">推荐</option>
            <option value="is_new">新品</option>
            <option value="is_hot">热销</option>
        </select>
        <!-- 关键字 -->
        关键字 <input type="text" name="keyword" size="15" />
        <input type="submit" value=" 搜索 " class="button" />
    </form>
</div>

<!-- 商品列表 -->

<div class="list-div" id="listDiv">
    <table cellpadding="3" cellspacing="1">
        <tr>
            <th>编号</th>
            <th>商品名称</th>
            <th>分类名称</th>
            <th>货号</th>
            <th>价格</th>
            <th>推荐</th>
            <th>新品</th>
            <th>热销</th>
            <th>操作</th>
        </tr>
        <?php if(is_array($data["list"])): $i = 0; $__LIST__ = $data["list"];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><tr>
            <td align="center"><?php echo ($vo["id"]); ?></td>
            <td align="center" class="first-cell"><?php echo ($vo["goods_name"]); ?></td>
            <td align="center" class="first-cell"><?php echo ($vo["cate_id"]); ?></td>
            <td align="center"><?php echo ($vo["goods_sn"]); ?></td>
            <td align="center"><?php echo ($vo["shop_price"]); ?></td>
            <td align="center"><img onclick="is_toggle(this,<?php echo ($vo["id"]); ?>,'is_rec')" src="/Public/Admin/Images/<?php if(($vo["is_rec"]) == "1"): ?>yes.gif<?php else: ?>no.gif<?php endif; ?> "/></td>
            <td align="center"><img onclick="is_toggle(this,<?php echo ($vo["id"]); ?>,'is_new')" src="/Public/Admin/Images/<?php if(($vo["is_new"]) == "1"): ?>yes.gif<?php else: ?>no.gif<?php endif; ?> "/></td>
            <td align="center"><img onclick="is_toggle(this,<?php echo ($vo["id"]); ?>,'is_hot')" src="/Public/Admin/Images/<?php if(($vo["is_hot"]) == "1"): ?>yes.gif<?php else: ?>no.gif<?php endif; ?> "/></td>
            <td align="center">
            <a href="" target="_blank" title="查看"><img src="/Public/Admin/Images/icon_view.gif" width="16" height="16" border="0" /></a>
            <a href="" title="编辑"><img src="/Public/Admin/Images/icon_edit.gif" width="16" height="16" border="0" /></a>
            <a href="<?php echo U('dels','goods_id='.$vo['id']);?>" title="回收站"><img src="/Public/Admin/Images/icon_trash.gif" width="16" height="16" border="0" /></a></td>
        </tr><?php endforeach; endif; else: echo "" ;endif; ?>
    </table>
    <!-- 分页开始 -->
    <table id="page-table" cellspacing="0">
        <tr>
            <td width="80%">&nbsp;</td>
            <td align="center" nowrap="true"> 
                <?php echo ($data["pageStr"]); ?>
            </td>
        </tr>
    </table>
<!-- 分页结束 -->
</div>

</div>
<div id="footer">
共执行 3 个查询，用时 0.162348 秒，Gzip 已禁用，内存占用 2.266 MB<br />
版权所有 &copy; 2005-2012 上海商派网络科技有限公司，并保留所有权利。</div>

</body>
</html>
<script type="text/javascript" src="/Public/Admin/Js/jquery-1.8.3.min.js"></script>

    <script type="text/javascript">
        function is_toggle(obj,goods_id,field){
            // 触发ajax
            $.ajax({
                url:'<?php echo U("setStatus");?>',
                data:{goods_id:goods_id,field:field},
                type:'post',
                success:function(res){
                    if(res.status==1){
                        if(res.ztm==1){
                            // 表示图需要使用yes
                            $(obj).attr('src','/Public/Admin/Images/yes.gif');
                        }else{
                            $(obj).attr('src','/Public/Admin/Images/no.gif');
                        }
                    }
                }
            });
        }
    </script>